package org.chickymate.server.controller.command.dto;

import java.util.ArrayList;
import java.util.List;

import org.chickymate.client.model.HostDTO;
import org.chickymate.server.model.Host;


public class GetPopularHostsCommand extends DTOAbstractCommand {

	public List<HostDTO> execute() {
		return asDTO(getCommentDao().getPopularHosts());
	}

	private List<HostDTO> asDTO(List<Host> hosts) {
		List<HostDTO> hostDTOs = new ArrayList<HostDTO>(hosts.size());
		for(Host host : hosts) {
			hostDTOs.add(host.asDTO());
		}
		return hostDTOs;
	}
}
